PowerTCP Mail for .NET
Read(Byte[],Boolean) Method
See Also  Send comments on this topic.
Dart.PowerTCP.Mail Namespace > SegmentedStream Class > Read Method : Read(Byte[],Boolean) Method




buffer
The storage location for the received data.
fill
Always true, use this version of Read to completely fill the buffer
Read data from the stream until a byte array is filled.

Syntax

Visual Basic (Declaration) 
Public Overloads Function Read( _
   ByVal buffer() As Byte, _
   ByVal fill As Boolean _
) As Integer
Visual Basic (Usage)Copy Code
Dim instance As SegmentedStream
Dim buffer() As Byte
Dim fill As Boolean
Dim value As Integer
 
value = instance.Read(buffer, fill)
C# 
public int Read( 
   byte[] buffer,
   bool fill
)
Managed Extensions for C++ 
public: int Read( 
   byte[]* buffer,
   bool fill
) 
C++/CLI 
public:
int Read( 
   array<byte>^ buffer,
   bool fill
) 

Parameters

buffer
The storage location for the received data.
fill
Always true, use this version of Read to completely fill the buffer

Return Value

The total number of bytes read into the buffer. This will either be the value of the count parameter, or zero if the stream has closed.

Exceptions

ExceptionDescription
System.IO.IOExceptionThrown when the stream is not Readable.
System.ArgumentNullExceptionThrown when the receiving buffer is null.
System.IO.EndOfStreamException Thrown when the end of the stream was found before the required byte count was received. When this occurs the Available property will indicate how much data may be read and the CanRead Property will return true.

Remarks

This method reads data from the stream and returns when the provided buffer is completely full or end of stream is reached. This method is a good way to read fixed-length data. An example of this is with HTTP chunking, which occurs when the server breaks up the HTTP response into fixed-size chunks. Each chunk is preceded with a hexidecimal value notifying the receiver of the size of the data chunk to follow. Initialize a byte array to this value, then call this method to fill the byte array.

Requirements

Target Platforms: Microsoft .NET Framework 2.0

See Also

Documentation Version 3.2
© 2010 Dart Communications. All Rights Reserved.